package com.ux.tween
{
	import flash.display.DisplayObject;
	import flash.utils.Dictionary;

	
	/**
	 * @author winnie
	 */	
	public class TweenUx extends TweenCore
	{
		
		private static var dicTween : Dictionary = new Dictionary(true);
		
		
		/**
		 * @param _target
		 * @param _duration
		 * @param _eff
		 * @return 
		 */
		public static function to( _target:DisplayObject, _duration:Number, _eff:Object ):TweenUx
		{
			if( dicTween[ _target ] ) killTweenOf( _target );
			dicTween[ _target ] = new TweenUx( _target, _duration, _eff );
			
			return dicTween[ _target ] as TweenUx;
		}
		
		public static function killTweenOf( _target:DisplayObject ):void
		{
			if( dicTween[ _target ] )
			{
				( dicTween[ _target ] as TweenUx ).killTween( _target );
				delete dicTween[ _target ];
			}
		}
		
		/**
		 * @param _target
		 * @param _duration
		 * @param _eff
		 */		
		public function TweenUx( _target:DisplayObject, _duration:Number, _eff:Object )
		{
			super( _target, _duration, _eff as TweenUxVars ? _eff.value : _eff );
		}
	}
}